/**
 * @author LKQ
 * @date 2022/1/4 15:51
 * @description 数组
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.fib(4));
    }
    public int fib(int n) {
        int[] nums = new int[31];
        nums[0] = 0;
        nums[1] = 1;
        for (int i = 2; i <=n ; i++) {
            nums[i] = nums[i-1] + nums[i-2];
        }
        return nums[n];
    }
}
